

https://www.tradingview.com/script/JuU7De7l-FDI-Adaptive-Non-Lag-Moving-Average-Loxx/

What is the Fractal Dimension Index?
The goal of the fractal dimension index is to determine whether the market is trending or in a trading range. It does not measure the direction of the trend. A value less than 1.5 indicates that the price series is persistent or that the market is trending. Lower values of the FDI indicate a stronger trend. A value greater than 1.5 indicates that the market is in a trading range and is acting in a more random fashion.

per = input.int(30, "Fractal Period Ingest", group = "Adaptive Settings")
speed = input.int(20, "Speed", group = "Adaptive Settings")
ColorSteps = input.int(50, "Color Period", group = "Adaptive Settings")


fdip(float src, int per, int speedin)=>
    float fmax = ta.highest(src, per)
    float fmin = ta.lowest(src,  per)
    float length = 0
    float diff = 0
    for i = 1 to per - 1
        diff := (nz(src[i]) - fmin) / (fmax - fmin)
        if i > 0
            length += math.sqrt( math.pow(nz(diff[i]) - nz(diff[i + 1]), 2) + (1 / math.pow(per, 2)))
    float fdi = 1 + (math.log(length) + math.log(2)) / math.log(2 * per)
    float traildim = 1 / (2 - fdi)
    float alpha = traildim / 2
    int speed = math.round(speedin * alpha)
    speed
    
    
    
    

https://www.tradingview.com/script/Grr7TmFj-Fractal-Dimension-Index/

The Fractal Dimension Index is a technical indicator that gauges the amount of volatility currently present in the market.

The theory behind this indicator is that a value of 1.5 suggests the market is acting in a completely random fashion. As the market deviates from 1.5, the opportunity for earning profits is increased in proportion to the amount of deviation.

Keep in mind that the indicator does not show the direction of trends! Although you can try to test it as a trend-following indicator that gives trend-following signals, that isn't the intended use of the indicator.

The Fractal Dimension Index is red when the market is in a trend. And it is blue when there is high volatility. When the Fractal Dimension Index changes its color from red to blue, it means that a trend is finishing. The market becomes erratic and high in volatility when the Fractal Dimension Index is blue. Usually, these "blue periods" do not go on for a long time, they come before a new trend.

So, look for trend-following signals while the Fractal Dimension Index is blue since this indicates high volatility before a potential trend, and avoid trend-following signals when the Fractal Dimension Index is red since this indicates a ranging/non-trending market or a trend that started long ago.

      ,    ,      .

,     ,   ,   1,5 ,      .   ,     1,5,       .

,      !        ,   ,     ,      .

   ,     .  ,    .          ,  ,   .     ,     .       ,    .

     ,     ,         ,      ,     ,       /      .

